#coding=utf-8

require "aio/core"

class Aio::Module::Cmd::Cisco::ShowProcessCPU < Aio::Module::Cmd::Cisco
  include Aio::Module

  def initialize
    super({
      :cmd_full 		=> "show process cpu",
      :cmd_short		=> "sh pro cpu",
      :author				=> "Elin",
      :description	=> "This is Cisco Command# show process cpu",
      :ranking			=> Ranking_1,
      :platform			=> "all",
      :benchmark		=> {
        :seconds_5	=> ["<", 50],
        :minute_1		=> ["<", 50],
        :minutes_5	=> ["<", 50],
      }
    })
  end

  def parse
    cont = self.context.dup
    cpu = {}
    useful[:cpu] = cpu

    cont.readline_match_block(/one minute: (?<minute_1>\d+)%; five minutes: (?<minutes_5>\d+)%/) do |block|
      #block.warning_serious(cpu, :seconds_5, self)
      #block.warning_serious(cpu, :minute_1, self)
      block.warning_serious(cpu, :minutes_5, self)
    end
  end
end
